package cvo.chess.client.entities.game;

import cvo.chess.client.entities.IGameFacade;

public abstract class Piece implements IPiece {

	//The name of the piece is generally used for debug purpose
	private String name;
	protected IGameFacade gf; 
	protected Army army;
	
	public Piece(IGameFacade gf, Army army)	{
		//By Default use the Class-name of the Piece (ex "Pawn")
		this.name = this.getClass().getName().substring(
				this.getClass().getName().lastIndexOf('.')+1);
		this.gf = gf;
		this.army = army;
	}
	
	/**
	 * 
	 * @param name The name of the piece
	 */
	public Piece(IGameFacade gf, Army army, String name){
		this(gf, army);
		this.name = name;
		
	}
	
	@Override
	public String toString(){
		return this.name; 
	}

    /* (non-Javadoc)
	 * @see cvo.chess.client.entities.armies.pieces.IPiece#getName()
	 */
    @Override
	public String getName() {
        return this.name;
    }
    
	@Override
	public String getColor() {
		// TODO Auto-generated method stub
		return army.getColor();
	}
}
